package com.ruoyi.zhjd.laboratory.modules.laboratorystressmachine.dto;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.util.Date;

/**
 * @ClassName LaboratoryStressMachineListDto
 * @Description 抗压强度列表对象
 * @author linhuawei
 * @since 2022-04-29
 */
@Data
public class LaboratoryStressMachineListDto {

    private String id;// 主键
    private String baseCode;// 基地编号
    private String baseName;// 基地名称
    private String deviceCode;// 设备编号
    private String deviceName;// 设备名称
    private String constructionSpot;// 施工部位
    private String testType;// 试验类型
    private String testId;// 试验id
    private Date testDate; // 试验日期
    private String concreteAge;// 龄期
    private String cubeArea;// 试件面积
    private String cubeCode;// 试件编号
    private Integer cubeCount;// 试块个数
    private String loadValue;//
    private String compressiveStrength;// 抗压强度
    private String representativeStrength;// 强度代表值
    private String designStrength;// 设计强度
    private Integer testEvaluation;// 评定结果 0 合格，1 不合格，2 无效，3 作废
    private String graphId;
    private String processStress;
    private String isQualified;// 合格1或者不合格0
    private Date createDate;// 入库时间

    private String[] loadValueArray;

    private String[] compressiveStrengthArray;

    private JSONArray processStressArray;

    public String[] getLoadValueArray() {
        loadValueArray = null;
        if (null == loadValue) {
            loadValueArray = new String[] {};
        } else {
            loadValueArray = loadValue.split(",");
        }
        return loadValueArray;
    }

    public String[] getCompressiveStrengthArray() {
        compressiveStrengthArray = null;
        if (null == compressiveStrength) {
            compressiveStrengthArray = new String[] {};
        } else {
            compressiveStrengthArray = compressiveStrength.split(",");
        }
        return compressiveStrengthArray;
    }

    public JSONArray getProcessStressArray() {
        processStressArray = new JSONArray();
        if (null != processStress) {
            processStressArray = JSONUtil.parseArray(processStress);
            String temp;
            for (int i = 0, len = processStressArray.size(); i < len; i++) {
                temp = processStressArray.getStr(i);
                processStressArray.set(i, temp.split(","));
            }
        }
        return processStressArray;
    }

}
